When you grind, you do throw away valuable AP. If you've already learned all your equipment's abilities, then the AP gained in battle is discarded. It's best to level up as you go through the game. This way you gain abilities as you grow.