It depends where and how you are working on these images.
If you are in Develop, selecting these in the Filmstrip, any change you make will only be applied to the active image unless you toggle on Develop's "AutoSync" feature which is a switch next to the Sync button at lower right. AutoSync, while on, will apply each new change across all highlighted images - Develop adjustments, everything - so use with caution.
In Library's Loupe view (a single image in the main window and multiple images highlighted in the Filmstrip): it is the same as in Develop. You'll apply rating to a single image unless you turn on AutoSync. Library has got its own AutoSync switch, which works independently of the switch in Develop.
In Library's Grid view (thumbnails in the main window), LrC presumes you want to work "in the batch":
pressing 3 will then apply 3 rating to all highlighted images, even without AutoSync being turned on.
But note, it is not completely consistent: some kinds of arguably more dangerous change, will not auto batch apply while in Grid view. This is I think a balance judgement, convenience vs risk. So control is put into our hands: to force / permit these kinds of slightly more 'risky' operation to apply across any and all images highlighted, is where AutoSync comes in.