In this paper the results of experiments on terahertz generation from nitride light-emitting diode heterostructures under two-photon excitation by femtosecond laser pulses are reported. Dependencies of the photoluminescence and terahertz spectra on structural properties of the samples and intensity of laser pulses have been studied. It was found that the terahertz pulse amplitude increases and its spectrum shifts towards higher frequencies with an increasing number of quantum wells in the heterostructures. Photoluminescence spectral shape change at high excitation intensities was observed. The probable mechanisms explaining the observed experimental dependencies are discussed.