Formula for ranks is as follows:
35 + (Attack Damage - Damage Taken) + (Max Card Combo x 3) - (Story Character Damage x 1.8) - (Turns x 2.7) + (Action Card Negated Damage x 0.8)
The number that results is checked against this chart
So be sure to consider: damage caused, damage received, number of maximum combos, number of turns, story character damage, number of damage defended against.
Each point of defended damage is + 1.8 points towards ranking, therefore be sure to defend lots of attacks against you. The following cards will help boost your rank:
Add a specific guard that fits your deck. So if you use Sword Types, add an SA Guard. AB enemies? AB Guard. Use one of these a battle, and you're almost guaranteed an S Rank.
Why? Using a Guard card essentially blocks for 99 damage, giving you 79.2 points towards what you need for an S Rank. With only very minimal more effort, an S Rank is assured.