What it happens is that those two plates form a "plate" capacitor. The code uses a two-pin set up: one pin charges up the capacitor, and goes into a high-impedance mode and you count the time it takes from the plate capacitor to discharge to a logic low on the 2nd pin (the pin without a resistor on).
The larger the capacitance and the lower the leakage between the two plates, the longer the time to discharge the capacitor. The capacitance is impacted by the size of the plate, the gap between the plates, and the liquid's dielectric constant (and how much liquid there is).
There is a slightly different approach that uses just one pin + adc.