A definition of Dynamic Range
All cameras are limited by the dynamic range of their sensors – that is, the ratio between the darkest and brightest details that may be recorded in an exposure. At the lowest end of the scale a sensor is limited by noise; at the other, the capacity of the pixel will determine how much charge it can store before being saturated.
As the sensors inside DSLRs and compact system cameras tend to have larger pixels than those inside compacts, they usually offer a broader dynamic range. So, in scenes that have a wide range of tones, compacts will typically struggle. Most compacts cannot capture, for example, a scenic landscape with details in both the ground and sky, so they will either produce an average exposure which tries to balance the two elements, or one where the details on the ground are well exposed but at the expense of the sky, or vice-versa. With a DSLR, an Neutral Density Grad filter may be used to compress the intensity range of the scene, and in other images the use of flash can brighten a darker subject against a lighter background.
Raw files contain a wider dynamic range than JPEGs, as Raw data is not subject to the processing that JPEGs undergo as standard, so shooting and processing Raw images is a good idea when the scene contains a wide dynamic range. Most of today’s cameras also incorporate some sort of dynamic range optimization which can help to balance scenes with a wide dynamic range. How these systems work varies between manufacturers; one method is to capture the image at a sensitivity different to the one stated, typically to underexpose lighter areas before being processed with the rest of the image. Another is to apply a tone curve to the image (essentially on the same principle as Curves in Photoshop); other techniques include slowing the rate at which increasingly brighter details record as brighter in the image, helping to preserve highlight details.