In vanilla there are four "categories" of magic: Restore, Attack, Indirect and "Forbidden". Each magic action is assigned to one of these categories in a specific order. If a character has even one of these actions in a category, the entire category is added to the magic menu for that character including the not-enabled magics that will just appear as a blank in the menu. If a character doesn't have a magic action in a given category, the entire category is omitted from the magic menu for that character. The categories can be rearranged in the options menu, though Forbidden will always be last.
eg.
Aerith has Cure1, Cure2, Poisona, Barrier and MBarrier on her. Cure1, Cure2 and Poisona belong to the Restore category and the Barriers belong to the Indirect category. Her battle menu would then look like this:
Cure1 Cure2
Poisona
Barrier MBarrier
Those blank lines fill out the Restore category and pad the beginning of the Indirect category.