I have a vague memory that guard mode ups your defence at the expense of your attack (as well as getting the unit to hold formation). So it would be useful when receiving an attack, perhaps especially for spearmen against cavalry. More generally, you could use it to protect an "anvil" units on the front line knowing that the real killing will be done by your "hammer" units about to strike on the rear or flank.

I must say I share Froggy's perception that guard mode often does not seem to give me desired results so I usually don't bother with it for my Romans infantry. They are supposed to get out their and kill things, not turtle. But maybe I should use the formation more.