Blossom end rot is caused by lack of calcium in the fruits. Calcium deficiency reduces cell membrane permeability and this leads to swelling of the cells followed by leakage and destruction of the membrane structure. There is also a reduction in growth of new cells. This causes the characteristic dark, sunken areas.
It is very rare for soils, growing bags or potting media to actually lack calcium. There is almost always plenty in the soil and indeed within the plant. However for calcium to reach the parts of the plant that are furthest from the roots there needs to be a good flow of water through the plant. The fruits are distant from the roots and do not compete as well as the leaves for calcium, leading to a local lack of calcium at the ends of the fruit.
Plants grown with limited root space (e.g. in pots or growing bags) are most at risk of irregular water supply leading to local calcium deficiency in the fruits. Plants in border soil, whether outdoors or in the greenhouse, are less likely to be affected.
A similar problem can arise if fertiliser is added to dry soil around plants, because the concentrated nutrients in the soil water will restrict water uptake by the plant. Additionally, some fertiliser ingredients - ammonium salts for example - compete with calcium for access to the plant roots, further exacerbating the calcium deficiency.
Very high air humidity can also limit water uptake by plant roots, so good daytime ventilation of greenhouses is helpful.