We present a Greens function based framework for modeling the scanning tunneling spectrum from the normal as well as the superconducting state of complex materials where the nature of the tunneling process$-$ i.e. the effect of the tunneling matrix element, is properly taken into account. The formalism is applied to the case of optimally doped Bi$_2$Sr$_2$CaCu$_2$O$_{8+delta}$ (Bi2212) high-Tc superconductor using a large tight-binding basis set of electron and hole orbitals. The results show clearly that the spectrum is modified strongly by the effects of the tunneling matrix element and that it is not a simple replica of the local density of states (LDOS) of the Cu-$d_{x^2-y^2}$ orbitals with other orbitals playing a key role in shaping the spectra. We show how the spectrum can be decomposed usefully in terms of tunneling channels or paths through which the current flows from various orbitals in the system to the scanning tip. Such an analysis reveals symmetry forbidden and symmetry enhanced paths between the tip and the cuprate layers. Significant contributions arise from not only the CuO$_2$ layer closest to the tip, but also from the second CuO$_2$ layer. The spectrum also contains a longer range background reflecting the non-local nature of the underlying Bloch states. In the superconducting state, coherence peaks are found to be dominated by the anomalous components of Greens function.