They are route indicators. There are various types/styles/versions/sizes. The current preferred term is “alphanumeric route indicators”.
King Lazy is correct in that the type in the picture are what (in the past) were known as “stencil indicators”. This type/style/size is only permitted when the approach speed is relatively low. So they are normally used with position light (PL) shunt signals.
Network Rail now however use the term “miniature alphanumeric route indicators” (MARI).
The larger type, “Theatre indicators” are now called “standard alphanumeric route indicators” (SARI). As King Lazy says, they are normally only used with main aspect signals. There is a maximum approach speed where these are normally permitted to be used. At higher speeds, only position light junction indicators (PLJI) or “feathers” are permitted.
Over the years, the technology has changed. The 1970s type stencils in the photo will have conventional filament lamps, with a plate that has a matrix of holes. Behind this plate is sheet that blocks the light from passing through some of the holes, but which allows light through others, hence a number, or letter can be shown. One ‘box’ is provided per route, as they can only show one route.
Later came Fibre optic types which use quartz halogen lamps. All are now being replaced with LED (light emitting diode) types.
Here is a modern LED equivalent:

The main aspect head is showing a green, as the route is set for the main line.
On the left of this, the top head is a LED MARI. This will show an ‘S’ only when the signal is routed into the sidings in combination with the LED position light head (shunting signal) that is mounted under the MARI.
More information on
this web site.