It is critical that the ions arriving at step 3 have the same velocity. To ensure this the ions pass through a velocity selector. This a region with a uniform electric and magnetic field.
The electric field comes from a set of parallel plates. The field is perpendicular to the velocity of the ions and exerts a force of qE on the ions.
The magnetic field is perpendicular to both the ion velocity and the electric field. The magnetic force has a magnitude qvB, and is opposite in direction to the electric force. The forces balance when:
qE = qvB
E = vB
v = E/B
For ions with a larger speed the magnetic force exceeds the electric force and those ions are deflected out of the beam. Ions with a smaller speed are deflected out of the beam in the other direction, because for those ions the electric force is larger than the magnetic force.