The iPhone camera is pretty good, but some environments don't lend themselves to quality picture taking. With high-dynamic range (HDR) photography, the camera alters the image as it is being taken. The result is a photo that is the best possible quality, given your environment.
In HDR mode, the camera takes three pictures in rapid succession. Each image uses a different level of exposure: one for dark areas, one for light and one for midtones. After taking all three, the iPhone takes the best qualities of each image and stitches them together to produce a single high-quality image. If you're not happy with the final result, the phone saves both HDR and non-HDR versions of the picture.
To turn on this setting, select Options when the phone is in camera mode and turn on the HDR toggle. Note that this mode is best for up-close and outdoor portraits, and in dark environments (without flash). Do not use HDR in bright, sunlit conditions or when moving.