Crenellations are the notched tops of castle walls and towers, the familiar pattern of raised blocks and gaps. Encyclopaedia Britannica defines a battlement as a parapet made of alternating low openings called crenels (or crenelles) and high solid sections called merlons, which is why a wall with battlements is described as crenellated.
The design let defenders shelter behind the merlons while shooting arrows or throwing missiles through the crenels. Britannica notes that battlements appeared in ancient Chaldea, Egypt, Greece, and Rome, reached their fullest development in medieval Europe, and became mostly decorative by the end of the Gothic period as their military use declined.
Source: Encyclopaedia Britannica: Battlement
Image: Battlements of Hume Castle, Scottish Borders, Brendandh, CC BY-SA 2.5, via Wikimedia Commons.