Atomic spectral lines are due to transitions of electrons between different atomic energy levels E, followed by emission of photons.
In the case of two nuclear isomers the number of protons and the number of neutrons are identical, but the quantum states and in particular the energy levels of the two nuclear isomers differ.