JPEG compression relies on a number of techniques while reducing an image's storage size. Primarily it's the DCT stage which accounts for the gross bit reduction. This stage is controlled by the quality parameter. However, color is also used to advantage as follows.
It's experimentally verified that our eyes are more sensitive to brightness resolution than the chroma (color) resolution. To take advantage of this charactersitics, raw RGB image data is first converted into a YUV (or digital counterpart YCbCr) color space, in which Y represents grayscale brightness information and U-V (Cb-Cr) components represent the chroma; color hue and color saturation informations. Then you can perform a reduction in the U-V component signal bandwidths by lowpass filtering them (which equates to a reduction in effective color spatial resolution) and then see that the resulting reconstruction of the image looks almost the same.
Note that this is not the approach taken in image-video compression codecs. As I have said, they reduce the information based on a 2D-DCT transformation, which will result in a substantially better image quality and more data reduction. Keep in mind however that what's performed in the DCT domain (on 8x8 image blocks) is somehow equivalent to a variable cutoff lowpass filtering on the spatial domain. But it will be very effective in achieving bit reduction while keeping the quality high, unlike what's demonstrated below as a complete lowpass filtering of the whole channels at once.
The following MATLAB code demonstrates the effect.
I = double( imread('C:\matlab\...\Vegatable256.bmp') ); % read the Vegatable image
R = I(:,:,1); % Red channel
G = I(:,:,2); % Green channel
B = I(:,:,3); % Blue channel
% S1: JFIF COLOR-SPACE CONVERSION RGB-YCbCr MATRIX:
% ------------------------------------------------
% Y'CbCr (601) from "digital 8-bit R'G'B' all signals in {0, 1, 2, ..., 255}
M = [0.299 , 0.587 , 0.114 ;
-0.168736 , -0.331254 , 0.5 ;
0.5 , -0.418688 ,-0.081312; ];
% inverse matrix is used to convert YCbCr into RGB
Mi = inv(M); % use with (Cb-128, Cr-128) to get RGB
% S2 - Convert RGB to YCbCr :
% ---------------------------
Y = 0.299*R + 0.587*G + 0.114*B;
Cb = 128 - 0.168736*R - 0.331264*G + 0.5*B;
Cr = 128 + 0.5*R - 0.418688 *G- 0.081312*B;
% S3 - Design a simple 2D lowpass filter :
b1 = fir1(32,0.1);
b2 = b1'*b1;
% S4 - Apply lowpass filtering on the Y,Cb,Cr channles.
Y2 = conv2(Y,b2,'same');
Cb2 = conv2(Cb-128,b2,'same');
Cr2 = conv2(Cr-128,b2,'same');
% S5 - Reconstruct various coombinations :
% ----------------------------------------
% 1 - I1: only the color Cb, Cr is lowpass filtered
I1 = zeros(S(1),S(2),3);
I1(:,:,1) = Mi(1,1)*Y + Mi(1,2)*Cb2 + Mi(1,3)*Cr2; % R;
I1(:,:,2) = Mi(2,1)*Y + Mi(2,2)*Cb2 + Mi(2,3)*Cr2; % G;
I1(:,:,3) = Mi(3,1)*Y + Mi(3,2)*Cb2 + Mi(3,3)*Cr2; % B;
I1 (I1 > 255) = 255;
I1( I1 < 0) = 0;
% 2 - Only Luminance Y is lowpass filtered
I2 = zeros(S(1),S(2),3);
I2(:,:,1) = Mi(1,1)*Y2 + Mi(1,2)*(Cb-128) + Mi(1,3)*(Cr-128); % R;
I2(:,:,2) = Mi(2,1)*Y2 + Mi(2,2)*(Cb-128) + Mi(2,3)*(Cr-128); % G;
I2(:,:,3) = Mi(3,1)*Y2 + Mi(3,2)*(Cb-128) + Mi(3,3)*(Cr-128); % B;
I2 (I2 > 255) = 255;
I2( I2 < 0) = 0;
% 3- All of then lowpass filtered
I3 = zeros(S(1),S(2),3);
I3(:,:,1) = Mi(1,1)*Y2 + Mi(1,2)*Cb2 + Mi(1,3)*Cr2; % R;
I3(:,:,2) = Mi(2,1)*Y2 + Mi(2,2)*Cb2 + Mi(2,3)*Cr2; % G;
I3(:,:,3) = Mi(3,1)*Y2 + Mi(3,2)*Cb2 + Mi(3,3)*Cr2; % B;
I3 (I3 > 255) = 255;
I3( I3 < 0) = 0;
% DISPLAY THEM:
%I4 = zeros(2*S(1),2*S(2));
I4 = [I , I1 ; I2 , I3];
figure,imshow(I4/255);
title('UL: original, UR: Chroma only LPF to 0.1 bandwidth');
xlabel('LL: Y only LPF, LR: All channels LPF');
The output will be :

As you can see, when you reduced the chroma bandwidth to one tenth (in both directions, resulting in 1/100 overall) of the default, (in the upper right corner), there is little image quality loss. Sharpness and colors are retained. Note that originally Cb and Cr channels were lowpass type signals; i.e., they contained little energy in the high frequency regions which is thrown out by the filter.
However when you lowpass filter the Brightness (Luminance or Y) channel with the same filter, the result is a dramatic loss in image quality as shown on the lower right corner. This is because the brightness channel has significant high energy content and our eyes are sensitive to it.