A formal email is typically sent to someone you don't know well or to someone who's in authority. Examples of someone who you might send a formal email to include your professor, a public official, or even a company you're doing business with.
If your workplace has a formal environment, use formal emails with your boss and colleagues unless you're told to do otherwise. Many workplaces are moving towards a more casual environment and this often carries over to email communications.