Fundamental biological functions, most notably embriogenesis, cell growth, cell differentiation, and cell apoptosis, are in part regulated by a complex genomic network that starts with the binding (and activation) of retinoids to their cognate receptors, members of the superfamily of nuclear receptors. We have studied ligand recognition of retinoic receptors (RXRalpha and RARgamma) using a molecular-mechanics-based docking method. The protocol used in this work is able to rank the affinity of pairs of ligands for a single retinoid receptor, the highest values corresponding to those that adapt better to the shape of the binding site and generate the optimal set of electrostatic and apolar interactions with the receptor. Moreover, our studies shed light onto some of the energetic contributions to retinoid receptor ligand selectivity. In this regard we show that there is a difference in polarity between the binding site regions that anchor the carboxylate in RAR and RXR, which translates itself into large differences in the energy of interaction of both receptors with the same ligand. We observe that the latter energy change is canceled off by the solvation energy penalty upon binding. This energy compensation is borne out as well by experiments that address the effect of site-directed mutagenesis on ligand binding to RARgamma. The hypothesis that the difference in binding site polarity might be exploited to build RXR-selective ligands is tested with some compounds having a thiazolidinedione anchoring group.