The transistor is used as a common-emitter amplifier. As such it has a voltage gain of about 30. When the generator puts outs a small voltage (~0.1V), the gain of the amplifier amplifies it to almost 3V at the output. As the output of the generator gets higher, the amplifier still amplifies it, but the output now saturates, turning the wave into a square-wave. Since all the PIC wants to see is the period of the wave (not its shape), that is fine.
Since the generator puts out such a wide range of output amplitudes, 0.2 to 100V, some form of current limiting is required. That is why I used resistors with high resistance values to create the voltage divider. The primary purpose is to set the transistor's base bias operating point. The secondary purpose is to limit the current that flows as the generator puts out large voltages.
The base-emitter path into the transistor behaves like a forward-biased diode junction for generator current flowing into the transistor. The reverse diode across the base-emitter transistor junction is there to conduct when generator current flows in the other direction. It effectively protects the base-emitter transistor junction from excessive reverse voltage, and makes it so that the generator sees a symmetric load for both positive and negative voltages...