This is what they refer to as a 'coded landing'. There is a very brief passage about it in the Wiki article, UK Immigration Enforcement. You can also do a Google search on 'coded landing uk' to see where lots of people have experienced anxiety about them.
You can obtain a list of some of the codes using the Freedom of Information Act, others are ad-hoc.
Essentially, they are like 'cookies' that are passed between successive Immigration Officers. It's shorthand for something they wanted to pass along. When you returned again, the IO spotted it and then disappeared for a while to access your stuff on the secured workstation.
The best advice I can give if someone gets a coded landing is: ignore it. If you are playing things straight up, there is nothing to worry about.
Another thing they will write in pen on your stamp is the serial number of your landing card (and more recently, your residence card). They will do this if your visa leads to a settlement status.
You can always make a Subject Access Request to find out what your transcript contains, but it will not change anything and they do not have to disclose whatever attracted the coded landing if they don't want to.
Also, if you see the IO giving you a coded landing, it's fine to deal with it right then and there. To be specific, you can ask "Would you please explain why I am receiving a coded landing?" Or even "Would you please explain the significance of the stamp you have just used and the amendment(s) you have made on it?" or "Does this stamp contain any information or terms I need to be aware of?". They will explain what they think you need to know and make sure that your understanding is complete (it's their job to do that). If there are lots of people in the queue, they will ask you sit in the secured area until they finish with the other customers. What they will NOT do is change their minds about it.
the border control officer went away for about 10 minutes to do something before letting me in
, if that happened means you are probably a marked person in their records, because of the first time.