Ratings are time based, how close you are to the target time (weapons and stats will affect target time, but it will always be the same with identical setups).

So, if you rush, and kill him quickly, but nearly die yourself, that's a 5 star. If you take your time and totally dominate the battle, that's a 0 star.

Since I am of the opinion that overall speed is the last thing that should ever enter into an RPG, I am not much of a fan of the rating system.