The nature of the ISM in galaxies during the star-formation activity peak of the Universe