We demonstrate ultrafast optical switching of the transmission of terahertz radiation through a metal grating with subwavelength holes. By fabricating the grating on a semiconductor silicon substrate, we are able to control the grating transmission intensity by varying the photodoping level of the silicon and thereby the resonant coupling to the metal grating. As such, we are able to switch the transmission on picosecond time scales with low visible light intensities, observing a factor of 2-5 improvement in photomodulation efficiency at resonance wavelengths over a bare silicon surface.