X-ray imaging has conventionally relied upon attenuation to provide contrast. In recent years, two complementary modalities have been added; (a) phase contrast, which can capture low-density samples that are difficult to see using attenuation, and (b) dark-field x-ray imaging, which reveals the presence of sub-pixel sample structures. These three modalities can be accessed using a crystal analyser, a grating interferometer or by looking at a directly-resolved grid, grating or speckle pattern. Grating and grid-based methods extract a differential phase signal by measuring how far a feature in the illumination has been shifted transversely due to the presence of a sample. The dark-field signal is extracted by measuring how the visibility of the structured illumination is decreased, typically due to the presence of sub-pixel structures in a sample. The strength of the dark-field signal may depend on the grating period, the pixel size and the set-up distances, and additional dark-field signal contributions may be seen as a result of strong phase effects or other factors. In this paper we show that the finite-difference form of the Fokker–Planck equation can be applied to describe the drift (phase signal) and diffusion (dark-field signal) of the periodic or structured illumination used in phase contrast x-ray imaging with gratings, in order to better understand any cross-talk between attenuation, phase and dark-field x-ray signals. In future work, this mathematical description could be used as a basis for new approaches to the inverse problem of recovering both phase and dark-field information.