Compensators are muzzle devices that help reduce muzzle climb and recoil when you shoot a rifle.
Some also act as flash hiders, which help reduce the brightness of the blast when a bullet exits the muzzle.
But the main purpose of a compensator is to reduce muzzle climb allowing you to make quick follow-up shots without losing accuracy.
Those that act as flash hiders, not many of them do a good job of mitigating the blast signature. But many that act as brakes, do effectively help in reducing recoil. Which is why most compensators also act as muzzle brakes.
You can find a muzzle device that acts as a flash hider, brake, and compensator, but only very few of them can effectively do what each of these devices is designed to do. And if you do get one that does, it’s going to cost you.