I have mixed thoughts on this. I really don't think that it is so much to do with the school (although that does, of course, have a huge influence) but more to do with role models. I certainly did not go to a grammar school but I think I ended up ok.
Various studies have shown that a major indicator of future success for children is mother's prior academic achievement (ie children of better educated mothers do better in later life than those of less well educated mothers - father's education isn't as important - all other things being equal).
Just to put things in context, my mother left school at age 15 without any qualifications and started work the very next week in the typing pool at the offices of the local gas board (what later became British Gas). This was very much what was "expected" of young girls of her background in the 1950s.
In contrast, my father managed to pass the 11+ and ended up getting four O- levels at the Crypt grammar school before he left at age 16. Incidentally, it is still a grammar school and also performs well today with very good Progress 8 and Attainment 8 scores at GCSE and does well at A level also.
When I took my O-Level exams at the age of 16 in 1981 around 75-80% of people would leave school at age 16. Boys who had done particularly well might get apprenticeships as apprentice toolmakers or engineers (yes, it wasn't just Keir Starmer's dad); for most girls getting a "nice" office job was seen as a real prize.
Although, please don't think that the school was responsible for this gender divide. I went to a school that was in a very working class area in a "New Town" and it was set up to teach practical skills as much as academic ones. It was an ex-secondary modern; we were the first year not to take the 11+ and so be a comprehensive intake.
Certainly everybody was required to do metalwork and woodwork; cookery and needlework. However, my attempts at both a wooden aeroplane and a stuffed soft toy were equally terrible.
But, despite this, it was very clear that, when given a choice, boys overwhelmingly chose eg technical drawing and girls chose typing. (by the way, can you even imagine nowadays a secondary school offering technical drawing and typing as subjects in their own right?). Incidentally, I did choose technical drawing - and really enjoyed it, even though I was the only girl in the class.
Even in the Sixth Form there really wasn't much in the way of role models (for boys or girls actually). The only two people I can remember with a clear goal was the Head Boy who wanted to become a lawyer (he ended up getting an unconditional offer to study law from Cambridge and did go on to be very successful) and a girl who wanted to become a doctor (but her father was a GP anyway, actually our family GP).
However, things really changed when I got to university. For the first time in my life I came across people who were extremely focused and driven, they knew what they wanted out of life and believed that they could get it (although there were equally a number that were just out for a good time and a number of girls that were there to "catch" a potential husband - not joking).
What was the difference? Well, a lot of the people I met at university came from much more academically focused schools, private schools or just generally from a very upper-middle class background. They certainly hadn't learnt that a good job for a girl was a "nice" office job and they certainly hadn't been taught needlework or typing at school.
For example, in the Hall of Residence where I stayed in the first and third years there were quite a number of students from the various London medical schools.
The one thing that they all had in common was a belief that any job or profession was open to them if they simply tried hard enough - I think that there were actually more women than men studying medicine, even back then, and it simply didn't occur to these girls to think any differently than that she could and would become a doctor. What they also had in common, was a rather different family and school background to mine
All very different from the sort of environment I had grown up in prior to going to university.
The sort of expectations and role models that you have when younger really can make a huge difference to believing what you are capable of doing. It really can be hugely difficult to even comprehend going to university when you’ve never met anyone who has.
But this does not come from simply having been a selective grammar school. This was a "bog standard" ex-secondary modern that had one or two pupils every year go to Cambridge or Oxford and others go to universities that are in the Top 10 in the world.
The type of school isn't so important but it's more about role models.
Having said all this. I do note that in the latest figures available, my old school does now perform rather poorly on Progress 8 and, particularly, Attainment 8 scores.