wet sand them with 1500. Buff them with compound. Polish them with wax or sealant. Use a real buffer. Remember they are plastic so let the machine do the work and don't put a lot of pressure on the machine or you will mess them up beyond repair.
if that stuff is on the inside then don't waste your time doing the above and just replace the headlight assembly
try youtube and toothpaste
from what i hear and seen on youtube... toothpaste does wonders