There are 164 grammar schools remaining in the UK, although there were around 1200 in the early 1960s. They were phased out in the late 1960 and 1970s but not in all places. Thus the current distribution is very patchy, with some counties still largely selective and others fully comprehensive.
Grammar schools choose which children they will admit by organising entrance tests, sometimes called the eleven plus. The highest ranked students will secure a place at grammar school - meaning it is relative performance to other children that matters.
This ranking system is seen as the most appropriate way to choose students, although in some schools there are some places reserved for local students too.
Grammar schools also tend to have more of a focus on academic performance, than other aspects of the curriculum, but many comprehensive schools also have academic results.
It's always worth checking out school OFSTED reports to get an idea on the overall qualities and performance of the school.