Space-variant Pancharatnam-Berry phase optical elements based on computer-generated subwavelength gratings are presented. By continuously controlling the local orientation and period of the grating we can achieve any desired phase element. We present a theoretical analysis and experimentally demonstrate a Pancharatnam-Berry phase-based diffraction grating for laser radiation at a wavelength of 10.6microm.