A compensator is a device that redirects some of the expanding gasses (that push the bullet out of the barrel) out of "vents" on top of the barrel. This venting pushes the barrel down (following newtons 3rd law), and helps reduce muzzle rise and some of the recoil/ kick.
They do help, all of the ones I am aware of are permanent. Maybe someone makes a screw-on model for threaded barrels. Ussually it is just holes drilled into a barrel, or a custom end on a barrel. Autos require modification of the slide over the vents in the barrel.
Check out this site. Mag-na-port International--The Mag-na-port Process: Handgun Porting