We review the general construction of distribution functions for gases of fermions and bosons (photons), emphasizing the similarities and differences between both cases. The central object which describes polarization for photons is a tensor-valued distribution function, whereas for fermions it is a vector-valued one. The collision terms of Boltzmann equations for fermions and bosons also possess the same general structure and differ only in the quantum effects associated with the final state of the reactions described. In particular, neutron-proton conversions in the early universe, which set the primordial Helium abundance, enjoy many similarities with Compton scattering which shapes the cosmic microwave background and we show that both can be handled with a Fokker-Planck type expansion. For neutron-proton conversions, this allows to obtain the finite nucleon mass corrections, required for precise theoretical predictions, whereas for Compton scattering it leads to the thermal and recoil effects which enter the Kompaneets equation. We generalize the latter to the general case of anisotropic and polarized photon distribution functions. Finally we discuss a parameterization of the photon spectrum based on logarithmic moments which allows for a neat separation between temperature shifts and spectral distortions.