In the first case, R is not a 3-D image, but a 2-D image, which MATLAB will display as grayscale. You created R as 2-D when you indexed in the red-only portion of the images in your statement:
In the second case, im_red is a 3-D image, It begins as identical to 'im', but then you set both the green and blue planes to zeros with:
>> im_red(:,:,2) = 0;
>> im_red(:,:,3) = 0;
Look at the dimensions of your matrices in the Variable window as you execute these command one-by-one, and I believe you will be able to follow along with what is happening.