I don't really know your history, so more info would help.
On the assumption that you are new to lifting:
It could be that your body is still or still need to adapt to regular exercise. This goes for the bones and ligaments just as it goes for muscle. What happens with knees, sometimes there are small bone fragments between the bones, where the upper and lower connect, and when you do exercise, this causes grinding on the bones. Hurts like hell. You need to get rid of these, by keeping on doing exercise until all of it is worked out, I suggest keep with low weights. The other option is to stop doing exercise that causes this grinding.
The other problem could be, your ligaments and muscles are too tight, and you need to add stretching to your program. Ie. Proper warmup before you start your first main exercise, and proper cooldown. Proper cooldown is stretching after all your exercises. Proper warmup can vary, you need to practise form with no weights or just a barbell bar before you add any weights, and work up your weights up to your working weight. Eg. if you do 80KG squats at 5 reps per set, start with 2x 20KG (just bar) sets of 10 reps. then 2x 40KG of 7-8 reps. then maybe 1x 60KG set of 4-6 reps. Then only do your actual working sets.
The other assumption is, if you are a regular gym visitor, then your problem is much more severe and you need a professional to give you advice on what to do.