When the battery voltage level rises, the voltage at the non-inverting input will also rise and by certain level (set with P1) the non-inverting input has a higher level than the inverting input.
The comparator is designed to have a hysteresis that prevents the circuit from “oscillating” (constantly switching on or off the relay) that could be cause by slight changes ti the battery voltage. This hysteresis is set with P2 which also sets the minimum battery voltage level at which the charging resumes.