Every ship has a class.
For example, the fighter is class 1. In battle, each class goes against the enemy class of the same number, so class 1 vs class 1. If the enemy is missing a class, then your class will attack the next higher class, for example class 1 vs class 2.
There are ships like the Campaign ship and Retreat fighter that cause the effect that another class battle begins, for example, class 1 could attack the enemy class 1 again, or make the class battle stop prematurely.