A group of German psychologists studied human perception and created a set of principles that explains the reasoning behind how we group things. The Gestalt principles have been adopted by designers and it plays a central role in communication design.
Human nature tends to group things. Gestalt principles help us understand that similar elements of design are visually grouped together. It's either the color, the size, or the shape that attracts the human eye and it automatically groups similar things together that might not be right next to each other.
This is applicable to color since we tend to see similar colors together as if they are a whole. In visual design, using similar colors gives the message that those elements are in the same group and have a similar meaning. To catch the visitors' attention you have to choose the right color. In that way, it is also easier to navigate through a website or even when you're looking through a poster. The colors and other elements navigate your eye where to look and how to proceed.