Two-photon excitation fluorescence (TPEF) microscopy has evolved into a versatile tool in biological research. However, the multiplexing capability of TPEF microscopy is limited by the narrow spectral bandwidth of the light source. In this study, we apply a photonic crystal fiber in TPEF microscopy to broaden the excitation source bandwidth. We tuned the spectral window using a spatial light modulator as a programmable diffraction grating that was placed behind a prism pair. In addition, we combined a grating pair to compensate for dispersion to improve the two-photon excitation efficiency. The combination of a broad spectrum and a programmable grating enabled fast spectral window tuning rate on a time scale of tens of milliseconds. We demonstrate the performance of our method by imaging live B16 cells labeled with four emission spectrum overlapped fluorescent proteins.