In a camera, every “pixel” is actually 3 pixels - all 3 identical on the sensor. Then the Bayer filter is on top, and filters one for red only, one for green only, one for blue only. You can still combine this into grayscale (many DIY spectrometers do), but that is like taking a red, a green and a blue LED to create white light. it works, but you have large missing chunks in your spectrum. The Bayer is not as narrow as LED emission so you can still detect the entire visible spectrum, but it creates a lot of dips and peaks, and you lose intensity (sensitivity) and can’t access NIR and UV.
Removing the Bayer leaves you with 3 identical pixels per pixel, but every subpixel now detects the entire visible range and a bit beyond. The software integrates all 3 subpixels into 1 grayscale pixel for increased sensitivity (I think). If you used it with a camera lens to take a picture now, it would be a rather odd grayscale picture, that also captures UV and IR.
In the spectrometer however, in front of the sensor there is not a camera lens, but a diffraction grating (that acts the same way as a prism for this application):
(Source: https://www.edmundoptics.com/knowledge-center/application-notes/optics/all-about-diffraction-gratings/)
The diffraction grating splits the incident light, and depending on the wavelength, bends it “more left” or “more right” on the sensor. This allows the spectrometer to use physical position on the sensor as a way of measuring the wavelength. Depending on the quality of grating and sensor used, one can go deep into sub-nm resolution. This here is a cheap grating (repurposed DVD) and a cheap sensor, so while it gets barely sub 1nm per pixel, the usable resolution is, even after calibration, not quite as low.
As a comparison, the 3 large white boxes on the left side on this pic are a spectrometer as well (all 3 together) and the large black cylinder on the rear left side is a liquid nitrogen cooled CCD sensor. This is how the large and spendy scientific tools look like And it probably is still pretty small by those standards.