You can use dimensional analysis to figure this out.
[tex]=3\ ml[/tex] × [tex]\frac{1g}{ml}[/tex]
= 3 grams
If done correctly, ml and ml will cancel out, leaving you with grams.
If you don't know dimensional analysis, simply multiply 3 ml by 1 grams and that should still get you 3 grams.