How does Jpeg encoding affect the final file size of 24BPP RGB and 8BPP grayscale image?
Take a standard R-G-B coded 24-bit image. First, suppose that all channels are coded independently. If by chance, R, G, and B are equal, each one will be converted to the same JPEG file with size $s$. 

But such an image would be visually grayscale. The corresponding JPEG compression of the grayscale would be about 3 times smaller (taking headers, etc. into account).

But in JPEG (and most image compression formats), color channels are not treated independently. They are first decorrelated into one luminance (L) and two chrominance images (U, V). If all channels were equal, ie if the image were grayscale as above, Y is the natural grayscale, U and V are zero. The latter two are compressed with almost zero-size, while the luminance is just JPEG compressed. 

So, an all gray 24-bit image and the corresponding 8-bit grayscale are JPEG compressed almost the same. In natural images, RGB channels slightly differ:



So if you convert them to YUV (luminance-chrominance), you get: 



Typically, the luminance one remains almost 8-bit in dynamics, while the two chrominance ones  are flatter, on 4-5 bits. The two latter can be compressed more heavily, as they can be downsampled (they look more low-pass) and amplitude-quantized.

Hence, to the first order, the most of the information is concentrated on the luminance part. So, if the channels do not differ too much, compressing the RGB or the grayscale with JPEG, for sufficiently high rations, is about the same.