Capacity margin is the percentage by which the expected total available electricity generation supply exceeds the expected peak level of demand, at the time at which that demand occurs.
For example, say peak demand is expected to be 10GW at 2pm. If there is expected to be a total of 12GW supply available at that same time (from whatever mix of sources: coal, nuclear, solar, wind etc.), the difference between the two is 2GW, or 20% of peak demand. So the Capacity Margin is 20%.
This margin acts as an insurance against the unexpected: be that losses of power due to unscheduled plant shutdowns, bad weather or unforeseen surges in demand. A capacity margin is thus essential to support security of supply and a bigger margin indicates a larger buffer against the unexpected.