Unfortunately, there is not a clean 1 to 1 ratio between Spell Levels and CR. You can see this quite clearly by perusing the NPCs section of Volo's Guide to Monsters, focusing on pure-casters.
The Abjurer is CR 9 and casts 7th level spells
The Apprentice Wizard is CR 1/4 and casts 1st level spells
The Bard is CR 2 and casts 2nd level spells
Conjurer: CR 6, 5th level spells.
Diviner: CR 8, 8th level spells.
Enchanter and Transmuter: CR 5, 5th level spells.
Evoker and Necromancer: CR 9, 6th level spells.
Illusionist: CR 3, 4th level spells
As you can see, you can't clearly and obviously map CR to Spell Level because different spells of the same level can have dramatically different impacts on CR, based on which spell it is. This only makes sense...a Wizard with Meteor Swarm prepared is going to be a lot more directly lethal in combat than a Wizard with Astral Projection prepared.
So, just to give a more thorough examination, let's have a look at the Evoker. He's a CR 9. determining his defensive CR and half his offensive CR is easy.
Defensive CR is derived from an AC of 15 (CR 5), and 66 HP (CR 1/2). Due to the gap, we adjust the hp based CR two steps up (5 steps different, +1 to HP CR for every 2 steps different between HP and AC CR). So his defensive CR is 2.
In order for him to be CR 9, then his Offensive CR must be 16 ([2+16]/2 = 9). Let's do a bit of math to see if we're right. The Save components of his offensive CR tops out at CR 7. Chain Lightning (his 'punchiest' spell) fired into a crowd averages 200 damage in a single round (assuming it hits all 4 targets, which is the assumption made), in terms of damage dealt...that's a damage component of CR 24.
Damage Component CR of 24 is 17 steps higher than the Save component, so we subtract 8, giving us an Offensive CR of: 16. Exactly what we expected to see.
Thus, taking the average of 16 and 2, we get a CR of 9. Which is exactly what the Evoker is statted at.
So, you can see that when considering a spellcaster's CR, we compute their CR based on the damage output and Save of their punchiest spell.
Thus...if you want to add a damage dealing spell and not alter a creature's CR, then the Damage and Save of that spell must work out to be equivalent to the monster's already existing CR, so you aren't changing their Offensive CR.
So, for a CR 3 monster, the simplest effect would be to give them a spell that deals 21-26 damage on average, with a DC of 13. (You can play with these values in accordance with the Offensive CR guidelines in the DMG)
Unfortunately, even this guideline breaks down when you start looking at Crowd Control spells, or buff/debuff spells. It's hard to quantify how much of an impact these spells can have on combat because, intelligently used, crowd-control magic is devastating even if it doesn't do any damage.
It's at this point that, honestly, experience as a DM comes into play. Spells that make PCs switch teams can potentially boost the enemy's effective CR by an amount equivalent to whatever the CR of that PC would be. Spells that crowd control potentially increase the enemy's CR because there's the potential that it will lock PCs out of the fight.
So, for here...looking at Volo's Guide for a rule of thumb, I would say this as a rough and general guideline. This is NOT a perfect solution, but it's a stopgap that should work until you can build up enough DMing experience to handle it by gut-feel. If you are giving a monster a non-damaging spell that is useful in combat, do not give them a spell that is of a level higher than their CR.
So...
TL;DR
If you want to give them a damage-dealing spell, consider the impact of that spell on the Offensive CR table on DMG page 221. If you want to give them a combat-applicable but non-damaging spell, this will mostly be up to your judgement...but I would strongly recommend against giving them a spell of higher level than their CR. If you want to give them a purely utility spell that has no real impact on combat...do whatever.