In which file format should I shoot black and white photographs?
Everything I found on the internet was about black and white image scans and general image file formats.
Shoot in RAW, and export on whatever format you like. JPEG for example.
For print it can be on TIFF. And you could export at grayscale at 16 bits. But that is only for specialized usage. For most users, JPEG is fine.
An additional note. If you are editing your photo using Photoshop, keep your working files in Photoshop, masks, layers. And again, export to JPEG.
I will summarize that you have 3 types of files.
1) Original Files (RAW, or your original JPEG from the camera)
2) Working files (PSD, Gimp file, the recipe of the photo in lightroom)
3) Output files (JPEG, some resampled photos to upload to some website, TIFF files to be printed professionally, the new JPEG file you converted to grayscale from the original color photo, etc.)
To retain the most information and have the most flexibility when working with the file in post processing save your image in your camera's raw file format as you shoot them.
Just remember, everything in a raw file is a monochromatic luminance value. With a conventional Bayer mask half the pixels are filtered to be most responsive to green light, and one quarter are filtered to be most responsive to either red or blue light. But some red and some blue light does make it through the green filter, and some green light makes it through both the red filters and the blue filters. Very little to no blue light makes it through the red filters and vice versa. There is no real color information in a raw file. Only by demosaicing that information and knowing which color filter each pixel was filtered for can color information be interpolated from the raw data.
When you have all of that original information you have much more latitude with what you can do in post processing than if you had only saved a post-demosaiced image from the camera after it did the demosaicing itself based on the in-camera settings at the time. You can change a setting or move a slider and your post processing application will redo the demosaicing to apply the changes you have made to the original data collected by the sensor rather than applying it to the more limited information contained in a jpeg produced in camera.
For example, say you have taken a photo of a red and blue flower.
Imagine that the straight from camera B&W jpeg rendered both flowers in the exact same shade of gray. You can no longer see any difference between the tonal value of the red flower and the tonal value of the blue flower. Whatever global adjustments you make to the image will equally affect both flowers the same. The information regarding the different color of the two flowers has been irrevocably discarded.
Now imagine that you have a straight from camera color jpeg of the same scene. You have more information. You can perform global adjustments on the image that will affect the red flower and the blue flower differently. By applying a red filter you will darken the blue flower (by reducing the blue saturation) without darkening the red flower. Then when you convert to B&W the red flower will be a lighter shade of gray than the blue flower.
But you are still limited to only modifying the information that was contained in the color jpeg. Some information from the sensor contained in the raw data was discarded in the process of producing the jpeg in the camera and that information is not recoverable from the color jpeg any more than the difference between blue and red was not recoverable from the B&W jpeg that showed them as the exact same shade of grey!
Finally, imagine that you are working with the raw data from the camera. You have even more information than that contained in the color jpeg. In fact, you have so much information that your 24-bit monitor (8-bits per color channel) can't even display it all at the same time. What you see on your screen isn't all of the raw data from the file. Rather it is a demosaiced conversion to 8-bits per channel that is displayed on your screen. When you use certain sliders or settings the entire raw data is used to alter the conversion reduced to 8-bits that you see on your screen. All of the information collected by the sensor is still at your disposal. As long as you retain the raw file, you retain all of that information. Your editing is saved non-destructively as a set of instructions on what to do with that information.
As others are saying, avoid discarding the RAW files ".CR2" for most Canon cameras. Those raw files contain data that has to be interpreted by software and the image could look completely different if you're opening it with Photoshop vs the default image viewer on your PC. Once you enter the realm of processed images, you now have a set of pixels on your screen that you want to save for yourself or others and when it gets reopened it's as close to the original as possible.
PNG files are lossless and, if you can afford the space they consume, are the best option.
24-bit images contain 256 shades of gray and so a 256 color GIF will also be lossless, however it is less efficient than PNG and will result in larger file sizes with no gain other than compatibility with ancient computers.
JPEG has been going strong as the best quality-size tradeoff for a long time. Google is working on their WebP image format, which is said to not perform all that better than JPEG.
Also note the software used to convert images to JPEG can make major differences. Photoshop, for instance, can explicitly operate in greyscale mode so that when you save there's no sneaky color artifacts wasting space. GIMP and xnview also do a good job and offer lots of options for tuning JPEGs.
I'm slightly confused by what you mean by "In which file format should I save black and white photographs?".
If it's a scan of a black & white image you probably want to go with TIFF or PNG.
If you mean an image from a camera, then it's /not/ black and white, but colour, and you should, as already expressed, save it in RAW. But I'm concerned with why you would have called it a b&w image. Because you wish to /target/ a final b&w image by post processing, or because you are converting in-camera. If the later then you're probably not going to start doing work in post and so RAW is useless to you at this stage.
But, as you you asking the question at all you should certainly look at saving in RAW and doing your b&w conversions in post, using the colour in the image to help you achieve a more impressive final result. iirc Nix's Silver Efex is now free.
Might I also appeal for you to not fall into the trap of using color filters on camera as you would with b&w film stock? A strong red filter, for instance, will lose 75% of the resolution of your sensor due to the way the Bayer sensor works.