This work presents the development of two MEMS programmable diffraction gratings designed for spectroscopic applications in the visible, near- and mid-infrared. These devices have been developed to limit distortion of their optical surfaces at rest and throughout actuation in order to improve their optical performance. In the first part of this thesis, we present the development of a fully programmable micro diffraction grating (F-PMDG): a linear array of individually addressable micromirrors that can be vertically displaced by up to 1.6 µm. The F-PMDG design maintains a simple mechanical structure, avoiding a complicated fabrication procedure while limiting distortion of the micromirrors during actuation. This is achieved through in-plane separation of the electrostatic actuators and the optical surfaces of the micromirrors. Vertical displacement of the micrormirrors is controlled by electrostatic actuators placed on either side of the central micromirror. Actuators with two types of flexures have been implemented in the design of the F-PMDG: classical clamped-clamped (CC) flexures and center-symmetric serpentine flexures. Through analytical and numerical simulation, it has been shown that serpentine flexures reduce the dependence of the actuator on length and thickness allowing the mirrors to be designed with shorter actuators and thicker device layers. Rotational stiffness remains an issue for the serpentine flexures, requiring a high degree of lateral alignment during fabrication; however, as the mirror width is reduced down to 20 µm the rotational stiffness is shown to approach that of CC flexures. F-PMDG arrays with 4-64 micromirrors, 700 µm long and 20-120 µm wide, have been successfully fabricated using anodic bonding to transfer a single crystal silicon (SCS) layer from an SOI wafer onto a prepatterned electrode array. By varying the bonding conditions, the residual stress in the device layer has been limited to 2 MPa leading to flat SCS micromirrors exhibiting a peak-to-valley curvature of ∼ 7 nm over the length of the micromirrors (ROC=8 m). Surface profile measurements performed on fully actuated micromirrors reveal peak-to-valley curvatures of <10 nm (ROC=7 m), equivalent to phase variations of λmin/40 (λmin = 400 nm) over the surface of the micromirror. Optical flatness of the micromirrors during actuation is in part due to the mechanical design of the device, and in part due to ground shields introduced to limit the effects of stray electrostatic fields which lead to crosstalk and undesired deformation of the micromirrors. Ground shields are shown to significantly decrease mirror deformation during actuation. In the second part of this thesis, we present the optomechanical characterization and post-fabrication development of the variable pitch micro diffraction grating (VP-MDG) developed at the Swiss Center for Electronics and Microtechnology (CSEM). The 1 × 1 mm2 free-standing, stretchable blazed grating acts as a tunable spectral filter with a 1 nm linewidth in the near-infrared and an optical efficiency >90%. Tuning of the output wavelength by 5% is demonstrated with an applied voltage of 90 V. Period variations across the grating while tuning are found to reduce the optical efficiency of the device, but can be controlled through individual tuning of the grating halves and proper design of the mechanical compliance of the springs separating the mirrors. Through failure mode analysis, we conclude that electron beam evaporation for the deposition of optical coatings on compliant MEMS structures leads to device failure by stiction – not as a result of stress, mechanical shock, or temperature variations, but rather, by electromagnetic radiation from the rapid fluctuation in the acceleration field of the electron gun. Using this result, we have successfully deposited low stress optical coatings on the surfaces of the VP-MDGs using thermal (Joule effect) evaporation. We have also demonstrated the successful implementation of a VP-MDG in the external cavity of a quantum cascade laser. The VP-MDG acts as a high-efficiency, tunable spectral filter to select the output wavelength of the laser. The results presented in this work provide an important contribution to the field of diffractive MEMS (DMEMS). The advent of a simple, fully programmable array of micromirrors that remain optically flat during actuation will lead to high-efficiency, inexpensive, compact spectroscopic devices. In addition, the further development of a high-efficiency, widely tunable, spectral filter is beneficial for external cavity tunable lasers and microspectrometers.