Grammatical Evolution is an Evolutionary Algorithm which can evolve programs in any language described by a context-free grammar. A sequence of bits (the genotype) is transformed into a string of the language (the phenotype) by means of a mapping function, and eventually into a fitness value. Unfortunately, the flexibility brought by the mapping is also likely to introduce non-locality phenomena, reduce diversity, and consequently hamper the effectiveness of the algorithm. In this paper, we propose a novel technique for promoting diversity, able to operate on three different levels: genotype, phenotype, and fitness. The technique is quite general, independent both from the specific problem being tackled and from other components of the evolutionary algorithm, such as genotype-phenotype mapping, selection criteria, and genetic operators. We experimentally demonstrate its efficacy in a wide range of conditions and from different points of view. The results also confirm the preponderant importance of the phenotype-level analyses in diversity promotion.