A general method to describe the instrumental resolution function for grazing-angle X-ray scattering experiments is presented. A resolution function.R is introduced as the Gaussian joint-distribution function of the (interdependent) random deviation q' associated with the wavevector transfer q. Useful expressions for the mean square values of q' are derived for some common scattering geometries, such as rocking scans, and scans out of the plane of incidence. The mean square values related to the incident beam dispersion and the detector acceptance angles are included in the treatment of.R. As an example.R is incorporated in the calculation of the diffuse scattering from freestanding smectic films within the framework of the first Born approximation and the main resolution effects are discussed.