Bulwark, breastwork, rampart, parapet, bastion are comparable when they denote a structure above the ground that forms part of a fortification and is specifically intended for purposes of defense.
Bulwark is the most general and the least technical of these terms. It is or has been applied to various defensive structures (as a wall intended to keep out an enemy, a structure of logs, earth, or stones from behind which defenders can safely attack besiegers or an assaulting force, and a breakwater or sea wall).
The term is also extended to a person or a thing regarded as a firm, steadfast, or powerful defense or defender.
Breastwork applies chiefly to a structure of earth, often hastily thrown up and usually only a few feet in height, behind which defenders may crouch or stand so as to fire their guns from a protected position.
Rampart and parapet are the common technical terms especially when fortifications of the type that prevailed before World War I are under consideration. In this sense a rampart is an embankment round a place often, especially in old castles, built inside a moat and rising high enough to conceal forces lying behind it yet broad enough on its top level to permit the movement of men and of guns when they are needed in action.
A parapet is a structure rising above the top level of a rampart and serving as a breastwork for those aiming and firing guns and as a bulwark against the missiles of the enemy. But in less technical use rampart is applied to a wall or to an elevation or level on which defenders may operate when in action or which may be thought of as suitable for such action, and parapet is applied to a structure (as a low wall or a balustrade) resembling a parapet of a fortification populous.
Bastion applies to a projection extending from the main wall of a fortification; typically a bastion is a four-sided projection ending in an acute angle and providing a means whereby the enemy may be covered in several directions and the fortification protected from at least four angles.
In extended use bastion may differ from rampart in carrying a stronger suggestion of attack than of defense.