There are a few pests that can attack your colony of bees. This normally happens in winter when you bees are hibernating and not guarding the entrance 24hr a day.
Amazingly there is type of moth which is rather partial to bee wax. The moths don't attack the bees themselves but simply lay their eggs in the brood comb. This comb is full of protein from the cocoons of the bee larvae. If left untreated the moth larvae eat their way through most of the comb. You can kill the wax moth larvae by putting any affected frames in the freezer overnight.
A nice warm sheltered beehive seems like a cracking home to a mouse in winter. In the summer the hive is busy with bees which stops the mice from entering. However, in the winter the hive entrance is often left open to mice. If a mouse does get in the hive the bees will most likely not attack it. So, the best treatment is prevention. In the winter you make the hive entrance as small as possible.
This is not a problem with modern plastic hives - however wooden beehives are susceptible to attack from woodpeckers which create a hole in the side of the hive and eat the honey.
In the summer wasps will start getting interested in the hive and its contents. You will often see the odd one or two flying around inquisitively when you are going about the weekly inspection. Wasps are opportunistic hunters and if they discover a weak colony, especially one that is queenless or has a failing queen they will attack the de-motivated bees and rob it of its stores and larvae.
A strong colony will defend the hive killing any wasps that try to gain access through the entrance. However, as wasps continue flying later in the evening than bees, the hive is at risk when the entrance is not being so actively guarded. Therefore, you should always have the frames pushed up towards the entrance of the hive so that the colony is above the entrance and ready to instantly respond to any intruders.
You can set up a wasp trap and a simple plastic drink bottle filled with some sugary pop with the top inverted will do the job as well as anything. To stop bees falling into the trap you should add a good slosh of vinegar which will deter them but not the wasps. A drop of washing up liquid will break the surface tension enabling the wasps to be wetted easily and prevent them from escaping.