This thesis deals with specialization and how it is linked to sympatric speciation. The trait driving specialization is a cue recognition trait modelled with artificial neural networks that exploiters use to discriminate beneficial resources from detrimental resources based on the signals of the resources. Paper I investigates how haploid exploiters and the resources coevolve when the signals of the resources can evolve through mutations. We find that this coevolution can be a cyclic process with saltational changes between different stages and that evolution is only directional and the exploiters are only specialists in parts of this cycle. In simulations underlying Paper II the signals of the resources can not mutate but the exploiters have a diploid genome and the organisms reproduce sexually. We show that the disruptive selection stemming from exploiters specializing on different resources can overcome the homogenizing effect of sexual recombination when exploiters mate randomly and produce a functional genetic polymorphism with specialized exploiters. A functional genetic polymorphism removes the force of reinforcement but we run simulations where the exploiters have a mating gene determining if mating is random or if exploiters should mate assortatively in Paper III. We find that assortative invades the exploiter population and homozygote specialists evolve because the genetic polymorphism pays a cost by having some alleles being silenced (that is they do not contribute to the complete phenotype) in certain genotypes so a mutation in these silenced alleles is not selected against, which cause these alleles to accumulate deleterious mutations. The homozygote specialists, mating assortatively, are much more efficiently removing deleterious mutations from the population and hence can invade the population. Finally, in Paper IV we investigate the effects of resource and resource signal arrangements in the environment. We show that the environment can influence the evolution of specialization and sympatric speciation. By modelling a resource discrimination trait based on the interaction of epistatic genes we find a novel force promoting sympatric speciation over genetic polymorphisms