Grinding is most likely broken teeth on the plastic headlight gear. Idk why the headlights would flip up and down with the keyless lock.
To get to the motor assembly:
When you pop the headlight up, there should be a lower plastic tray bolted to either side of the headlight. Unbolt it, and use the adjustment screws to raise the headlight a little for clearance to pull the lower tray. You should now see a motor attached to a plastic gear box.
To replace the gear:
The motor is attached to a plastic gear box. Unbolt this combo together. Do not remove the motor from the gear box. There should be one side of the gear box that looks like a flat cover. It is glued on tight, you will have to pry this off, gently not to crack the housing. Use a sharp flat head screw driver and work your way around the cover. Once off you should see the white plastic spur gear up against the worm gear from the motor. Only pull out the white spur gear. The teeth should look broken or worn down.
Now, your options...Do it right and buy a replacement brass gear. Or go the cheaper route and buy a replacement plastic one. Its up to you if you want to gamble on doing this again. Grease the gears, and superglue the plastic cover back on. bolt everything back on and realign your headlight if you adjusted it for clearance.
If you are uncomfortable pulling apart the gearbox, I remember seeing a company on ebay that sold the motor/gearbox assembly, and you send yours in as a core. But this route is about $80 and they only put a plastic one back in. The do it yourself brass gear is like $40
EDIT: Damn you 5.7TA and your links