Flash hiders were designed by the military to reduce the visible flash from the firearm's muzzle. By doing this, a soldier's firing position would less likely be discovered by the enemy by observing the muzzle flash when firing. These devices are typically very open at the end with vents on all sides that allow gas to escape while hiding the visible flash. This device does nothing to reduce felt recoil.
Compensators are designed to redirect gas pressure escaping the barrel, after firing, to help control the direction a barrel moves when firing a bullet. Compensators typically aid in offsetting the effect of a recoil system that is weighted heavier on one side of a firearm than another (i.e. AK-47). Similar to the flash hider, these devices are usually very open at the end, with vents on the side that redirect gas. But compensators will block gas from escaping in a specific direction, which uses the gas channeled in other directions to help control the muzzle's movement to aid in recovery for more rapid target aquisition but does little to reduce felt recoil.
Muzzle brakes are intended to reduce felt recoil when a bullet exits a barrel by forcing the gas expelled behind the bullet to the side rather than forward. Muzzle brakes differ in design from flash hiders and compensators in that the end of the device is much closer to the actual diameter of the bullet, with much larger vents on the side. If you Google This forces more of the gas sideways which in turn negates some of the impact of Newton's third law of motion, and reduces the firearm rearward travel. As such, the faster the bullet exits the barrel, the more recoil reduction is felt. For example, an AR chambered in .308 with a muzzle brake will feel more recoil reduction than an AR chambered in .223 with a muzzle brake.
There are muzzle devices that are attempts at hybrid solutions: Muzzle brake-compensator, flash hiding-muzzle brake, even flash hiding- compensating-muzzle brakes. But as with any hybrid solution, with each additional cspability added to a hybrid solution, the overall benefits of each type of device is watered down.
The final category of muzzle device is suppressors. These devices are specifically designed to reduce sound associated with firing a bullet. The device is enclosed with baffles inside that redirect the and reduce the explosive sound of a bullet exiting the barrel. Suppressors also reduce felt recoil.
NOTE: the possession of suppresors is still tightly regulated by the federal government, and you must have a tax stamp before you can purchase or possess a supressor.
The URL below is for a YouTube video produced by Brownells that does a great job showing and discussing the differences of each type of muzzle device.