Abstract Searching for a target among many distracting context elements might be an easy or a demanding task. Duncan and Humphreys (Duncan, J., Humphreys, G.W., 1989. Visual search and stimulus similarity. Psychol. Rev. 96, 433–458) showed that not only the target itself plays a role in the difficulty of target detection. Similarity among context elements and dissimilarity of target and context are two main factors also affecting search efficiency. Moreover, many studies have shown that search becomes particularly efficient with large set sizes and perfectly homogeneous context elements, presumably due to grouping processes involved in target-context segmentation. Especially N2p amplitude has been found to be modulated by the number of context elements and their homogeneity. The aim of the present study was to investigate the influence of context elements of different heterogeneities on search performance using event-related brain potentials (ERPs). Results showed that contexts with perfectly homogeneous elements were indeed special: they were most efficient in visual search and elicited a large N2p differential amplitude effect. Increasing context heterogeneity led to a decrease in search performance and a reduction in N2p differential amplitude. Reducing the number of context elements led to a marked performance decrease for random heterogeneous contexts but not for grouped heterogeneous contexts. Behavioral and N2p results delivered evidence (a) in favor of specific processing modes operating on different spatial scales (b) for the existence of homogeneity coding postulated by Duncan and Humphreys.