Players encounter them, players slaughter them, players feel good about being so overly powerful (even though it was just a minion). That is their prime purpose.
The Common Enemy
While their intention is similar to the minion - to be slaughtered by the players - they actually do pose a (minor) threat for the PCs. This should usually be done by the common game mechanics, like having melee enemies with a high AC, casters with buffs (pre-cast preferably, unless no one really expected an attack) or painful spells, or those nasty rogues that sneak behind the healer of the party and try to take him out.
The general idea is that they pose a threat, brute force works, but it becomes easier if properly prepare. The abilities must come from the common rule-book, so players can "calculate" them to death ("It is a fire elemental, so we better use cold spells.") They are supposed to give the players the feeling of tactical supremacy, while their weaknesses are rather obvious.
This group of enemies consist of stronger and usually challenging enemies, that differ from the "common enemy" by a) having a name-tag, and b) having a mechanic that makes blind brute force not the preferred way of dealing with them, as the mechanic that makes them stronger is either not obvious or not easy to overcome.
The general idea is to give players a feeling of accomplishment by overcoming hidden features or discovering secrets that ultimately leads them to victory. While they can deal with those by just running into the fight, doing so will put them in serious danger, likely to cause death of at least one party member. The solution to fight these should be a form of a mini-quest, that can (and should) be taken by the players, but is not required to complete the story (because after all, players tend to fail).
Examples are enemies that posses very powerful (generic) equipment, granting them a much higher than normal set of stats, or artifacts that render them near immune to the primary form of attack executed by your players (e.g. armor of DR 5/magic at lower levels, forcing the players to find a magic weapon first, or just steal it from him). They could as well be able to cast spells, that could near instantly kill your players, forcing them to figure out how to avoid them. Or they could posses certain supernatural abilities, that makes them close to invulnerable except under certain situations (e.g. a Vampire with supernatural resistances, except at daylight).
What sets the boss apart from his minions is that he cannot just be rushed in and killed. He has some form of ability, equipment or tactic that makes it impossible for the players to fight him, until they overcome that feature.
They are the prime goal of a quest or series of quests, and are supposed to give the player a strong feeling of accomplishment by defeating them, knowing that the task wasn't easy at all, and required a lot of thinking, planning and teamwork. The trick is to find something, that is reasonable to explain, not too obvious as a blocker, but still keeps the players from just kicking in his door and cutting his throat. The goal of the quest is then to figure out how to circumvent or by-pass that ability so players are able to actually attack him.
Examples are enemies that posses certain very powerful abilities or (unlootable, because you don't want your players to run around with it) artifacts, that render the players unable to harm him, like a permanent stone-skin ability (lower levels), an amulet of instant retreat (teleports away at will), a guaranteed ability to kill at least one player like a Finger of Death with a high DC (demonstrate this properly it so they know!).
On the other hand those bosses do not necessarily have to be dangerous in combat, they could even give up immediately if actually engaged, but then the difficulty lies in actually getting a hold on them. Examples are the famous behind-the-scenes crime-lord, where players need to first learn who he actually is and especially where he hides, a being that exists on a different plane and cannot just be found without the proper spells, or a mummy that is hidden behind walls of riddles, puzzles and traps, while it itself is only of medium combat danger.
The main difference here is the amount of steps that are necessary to take till you are actually able to engage a boss. Weather or not this is combat skill is not important, it is just the hate piling up with the all failed attempts that makes killing them feel so good.