A voltage regulator, or VREG is designed to smooth out the DC sine wave created by the rectifier. The VREG is wired is series, connecting the Rectifier to the system. In order to fully understand it's function, you must understand half-wave rectification.
The rectifier on the TS,TC, and TM bikes are all Single diode, half-wave rectifiers. This means that the rectifier simply allows positive current to pass and blocks negative current to the positive line. This process causes the the positive line to pulse, at the same speed as the AC alternated. Which, in a magneto system, is the engine speed.
Voltage Regulation is the process of maintaining a steady output voltage irrespective of the input voltage. The faster the engine/generator is turned, the greater the voltage that is produced. A regulator helps to maintain a steady voltage for the electrical system.
Typically linear voltage regulators dissipate the additional power, this can cause heat within the device, hence, many units are supplied with heatsinks or are fastened to some metal part of the bike to dissipate heat.
Without a steady voltage within the electrical system, lights and other electrical items would be subject to the varying voltage generated by the generator. As the generator/engine speed increases the voltage increases, increasing light brightness and often blowing bulbs.
It is worth noting that on many bikes, battery charging is controlled by other means.
Ultimately, on this system the voltage regulator is not strictly necessary. Because the magneto only puts out enough voltage to run the system, the VREG does not need to reduce it. At the same time, the VREG only allows the bulbs to 'burn' brighter and the battery to charge more quickly. So if you are diagnosing a system in which the bulbs are not receiving power, as long as the VREG passes voltage (even if it is not regulating it) it is not the cause of the failure.