Aims. We aim to study the properties of the dense molecular gas towards the inner few 100 pc of four nearby starburst galaxies dominated both by photo dissociation regions (M 82) and large-scale shocks (NGC 253, IC 342 and Maffei 2), and to relate the chemical and physical properties of the molecular clouds with the evolutionary stage of the nuclear starbursts. Methods. We have carried out multi-transitional observations and analyses of three dense gas molecular tracers, CS, HC 3 N (cyanoacetylene) and CH 3 CCH (methyl acetylene), using Boltzmann diagrams in order to determine the rotational temperatures and column densities of the dense gas, and using a Large Velocity Gradients model to calculate the H 2 density structure in the molecular clouds.Results. The CS and HC 3 N data indicate the presence of density gradients in the molecular clouds. These two molecules show similar excitation conditions, suggesting that they arise from the same gas components. In M 82, CH 3 CCH has the highest fractional abundance determined in a extragalactic source (1.1 × 10 −8 ). Conclusions. The density and the chemical gradients we have found in all galaxies can be explained in the framework of the starburst evolution, which affects the chemistry and the structure of molecular clouds around the galactic nuclei. The young shock-dominated starburst galaxies, like presumably Maffei 2, show a cloud structure with a rather uniform density and chemical composition which suggests low star formation activity. Molecular clouds in galaxies with starburst in an intermediate stage of evolution, such as NGC 253 and IC 342, show clouds with a large density contrast (two orders of magnitude) between the denser regions (cores) and the less dense regions (halos) of the molecular clouds and relatively constant chemical abundance. Finally, the galaxy with the most evolved starburst, M 82, has clouds with a rather uniform density structure, large envelopes of atomic/molecular gas subjected to UV photodissociating radiation from young star clusters, and very different chemical abundances of HC 3 N and CH 3 CCH.