If light is neither absorbed nor scattered, it is transmitted through the substance. This occurs when the energy from the light is transferred into the substance, and the vibrations of the electrons are passed on through the substance and re-emitted on the other side. Different arrangements of atoms in substances can cause these vibrations to propagate differently through different substances. This is the cause of Snell's law.
Different substances absorb specific wavelengths of light. This is determined by the differences in energies of the different atomic or molecular orbitals. The energy of the photons promote electrons from the ground state to an excited state, and is then dissipated as vibrational energy as the electron returns to the ground state. All other light that does not match these energy differences are cause electrons to vibrate on a much smaller scale for a short amount of time before re-emitting the light, thereby scattering it.
White light consists of all the wavelengths of the visible spectrum. When all wavelengths are scattered by a substance, it appears white. When all visible light is absorbed, it appears black. The dissipation of all this energy absorbed by black substances explains why black cars get hotter in the sun than white cars.
When only some wavelengths of light are absorbed, the resulting scattered wavelengths constitute what our eyes perceive as color.
It's also important to note that visible light isn't the only part of the electromagnetic spectrum that can interact with matter. The spectrum ranges from high frequency gamma rays and x-rays to low frequency microwaves and radio waves. If you were wondering if there was anything particularly special about visible light, check out this physics post!