The issue with fluctuating utility or generator power is mainly brownouts (low voltage). This carries two kinds of risks. Running for prolonged periods at very reduced voltage can stress components, and if the voltage drops low enough, equipment can shut down. The result would be loss or corruption of files and corruption of the hard drive. To assess the risks in your situation, consider several things.
Is the voltage actually a problem?
Typically, generator backups are designed to support only emergency needs, so only selected circuits are on generator power. If it is intended to support some major appliances in addition to lighting, most appliances require voltage within a certain range. It wouldn't do much good if the generator damaged, or didn't support, the intended appliances. So even if you notice lights dimming, the voltage may actually be in an acceptable range.
However, if your situation is that all power circuits in the building are on generator backup and severe power problems are routine, or the generator is your primary power source and not a backup, there are concerns even without taking measurements.
What problems is the computer exposed to?
If the voltage is not in an acceptable range, the other side of the equation is your computer. A PC would be more susceptible to shutting down due to low line voltage since it has nothing to fall back on. A laptop charger will try to maintain the proper output voltage until it can't (so while the charger will be exposed to low voltage, the laptop will be protected). With most laptops, the battery will kick in if charger voltage is lost, so the laptop wouldn't shut down.
How to assess the risk?
If you don't have test equipment to evaluate the voltage so you can compare it to the equipment specs, you can assess the situation by observation.
If your laptop doesn't shut down during periods of low voltage or switch-over to the generator (or if you disconnect the charger from the wall but leave it plugged into your laptop), that isn't a risk for you.
You might be able to tell from the charging indicator or battery monitor whether the laptop switches to battery during brownouts. If it doesn't switch to battery (and doesn't shut down), that indicates that the charger is handling the voltage and will probably not be significantly affected. If it does switch to battery, the low voltage might shorten the life of the charger.
Should you buy a UPS?
If your situation calls for it, a UPS will protect you from both low voltage and unexpected shut down. However, even a low-wattage UPS sufficient for a laptop has a cost, and its internal batteries last only about three years. So if unexpected shutdown is not an issue but low voltage is, you would need to weigh the costs -- a UPS vs. the potential need to replace the charger during the service life of the laptop. Unless you are going through chargers periodically, it might be more cost effective to replace the charger, if needed, than buy a UPS.
However, you can continue to operate if a UPS dies, but if the charger dies, you're out of business when the battery runs down unless you buy a spare charger.