Is there any difference between both and both the? For example:
Both students passed the exam.
Both the students passed the exam.
Both windows are open.
Both the windows are open.
- Both windows
- Both the windows
- Both of the windows
All mean the same thing in most contexts. It all comes down to the use of the definite article "the", which is well documented, but I'll try and explain using this example.
I'm sure you know that you use the definite article when you are referring to a specific thing or a specific set of things. If there was only one window, it would be the window. If you say the windows in the plural form, it must refer to a specific set of windows, for example, the windows in one specific room to which you have already referred.
If you said "I walked into the room and both windows were open" without using the definite article, it would be fairly assumed that the room has only two windows. However, if you said "I closed one of the windows, but when I got back the window was open", because you used the definite article it would be assumed that the specific window you found open was the same window you closed, because you had referred to it previously. The same logic would apply if you had closed two out of four windows and then reffered to "both the windows".
So, while your two examples, as well as the third I added, can be used interchangeably in some contexts, in other situations your use of the definite article would make a difference to the meaning.