hi,
Basically the Cap or Inductor under test forms part of an inbuilt oscillator, the output of the LM311 is a square wave running at the frequency of the oscillator.
The PIC counts the square wave pulses over a fixed time, from that its possible to calculate the Cap or Inductor value.