Stun (a.k.a. Paralysis) is en element of gameplay and a type of Crowd Control effect, usable by both players and monsters.
The general concept is completely paralyzing the target, preventing them from movement, attacking, using abilities and activating skills for a short time. Some passive effects will still work, and certain skills can even be activated while Stunned, but generally, the target will remain completely helpless and vulnerable to attack.
Continuously stunning the same target and keeping it under control without giving it a chance to recover is known as Stunlock. It is often used by players against single enemies, but can be used by monsters too: a player cornered and suffering many blows per second is a very easy prey.
Most powerful enemies and Bosses are generally either highly resistant or immune to Stun.
In Diablo and Diablo II, causing a high degree of damage to a player or monster in one hit can cause a "micro-Stun", causing their hit recovery animation to play. While this is in progress, the target behaves as if it was stunned. The threshold that the hit must pass is influenced by the level or Life of the target hit, depending on the game.
In the original Diablo game, players could use the Stone Curse spell to paralyze the petrified target, leaving it essentially stunned. Micro-Stun was very common, and if a hit dealt enough Physical damage, the target will be pushed into a state of hit recovery. A high degree of attack speed, especially in the hands of a Warrior or a Barbarian, will ensure that once the target is hit, virtually nothing, not even the Lord of Terror himself, can survive the onslaught that normally follows.
In Diablo II, Stun is a separate effect that usually lasts a second or two. Some skills, including the Barbarian's Stun and Sorceress's Telekinesis, are applying the Stun to the target, causing the blue sparks (resembling the stereotypical cartoon "stars above head") to appear on the victim. Some monsters, like Maulers, even have this as a guaranteed effect on every hit.
Stun is often combined with Knockback. This is not always desirable for the attacker though, since Knockback can push a target out of the range of the weapon, making it harder to stunlock them (since one must then close range with the target before hitting again).
Although Stun works on most monsters in the game, Act Bosses possess full immunity to it.
In Diablo III, micro-Stun can no longer happen on players: taking damage will never cause them to be stunned unless combined with Knockback. However, monsters taking damage are very often suffering a micro-Stun. Monsters build up the crowd control resistance as they are continuously stunned, reducing the duration of subsequent Stuns. Some monsters have special abilities that add Stun to their attacks, such as Armaddons' melee blows. However, Stun is a much less common form of monster trait than Knockback.
A stunned target cannot perform any active actions (unless those are specifically stated to be usable while stunned, such as Diamond Skin), effectively being paralyzed. Obviously, channeled skills are interrupted by Stun.
Note that scripted event Stun effects (such as those in battles with Urzael and Diablo) are not reduced or prevented by any means: they serve to justify the player's inaction during the cutscenes, and are not part of the gameplay itself.