The monochromatic and polychromatic performance of a grating interferometer is theoretically analysed. The smallest detectable refraction angle is used as a metric for the efficiency in acquiring a differential phase-contrast image. Analytical formulae for the visibility and the smallest detectable refraction angle are derived for Talbot-type and Talbot-Lau-type interferometers, respectively, providing a framework for the optimization of the geometry. The polychromatic performance of a grating interferometer is investigated analytically by calculating the energydependent interference fringe visibility, the spectral acceptance and the polychromatic interference fringe visibility. The optimization of grating interferometry is a crucial step for the design of application-specific systems with maximum performance.