In the initial part of the battle, Ghirahim will simply walk towards you. He comes with one hand raised upward, glowing red. The purpose of this is to grab your sword when you slice at him. If he does grab your sword, do a down-up vertical slice, or he’ll steal the sword.
During this time, he also can slap you if you take too long to hit. Additionally, you’ll probably notice the red projectiles near him. If he grabs the sword and/or you take too long to hit him or get back your sword, they will hit you.
How do you hit him? Well, you need to lead his hand in one way, then quickly swing in a different way. If you do manage to hit him, be sure to hit multiple times, since he will be very temporarily stunned by the initial hit.
After taking a hit, he’ll also send some of the red projectiles at you – shield bash them or use the sword block, like in the last battle.
During this time, if he does manage to steal away your sword, you have two options. You can run around until he throws your sword at you, at which point you can grab it, or you can shield bash him during a slash.
Continue attacking for a while, after which it’ll change a bit.
In the second half of the battle, Ghirahim will use his two swords and will use three attacks. One involves teleporting and slashing at you (kind of like Sephiroth in Kingdom Hearts). Another involves a running tackle and slash combo, and another has Ghirahim surrounding you with red projectiles.
Another has him doing a nosedive onto you – you can only run around to avoid this, although you can get a few hits in when he lands. He also has a (usually) counterattack whenever you hit his swords rather than him when he holds them up in those configurations.
For the first attack, just jump around, preferably backwards (because he’ll appear from behind, and his position is apparently determined upon actually teleporting).
For the second, shield bash Ghirahim to stun him and get a few hits in, or swing at him on the side his sword isn’t on. As for the third, execute a spin attack that will hit all of the projectiles.