A comparator is a device which has its own reference voltage and compares it with any external input voltage to tell you if the input voltage is higher or lower than the reference voltage.
The schematic diagram shows you that this reference voltage is about 4.5 V and is applied to the pin 2 of IC 324. Input voltage is supplied to the pin 3 of IC 324, and the LED lights up if this voltage is higher than the reference voltage, and goes out if it is lower than the reference voltage.
Now, let's see how this comparator works. Slide the select switch down to supply 3V. The LED doesn't light up, does it?
Now slide the select switch up. This makes the input voltage to pin 3 to 6V. The comparator outputs a voltage as the input voltage is now higher than the reference voltage, and the LED lights up.