We review the results of a statistical mechanics approach to granular materials and its extension to non-thermal systems in their "inherent states". We introduce a "tapping" dynamics, based on a dynamics used for real granular matter, which allows to visit the space of the inherent states. It is assumed that under stationarity or quasi-stationarity the distribution among the inherent states satisfies the principle of maximum entropy. This leads to a distribution characterised by a configurational temperature related to Edwards compactivity. The prediction from such an approach are checked on a standard Hamiltonian lattice model and, in the present unifying framework, it is possible to explain a variety of properties of granular materials, ranging from their logarithmic compaction to typical "memory" phenomena. (C) 2001 Published by Elsevier Science B.V.