$user->roles is an array of the roles that belong to the user keyed by the role ID, value is the role string. So if you wanted to check if user had role 'authenticated user' your code snippet would look something like this (not necessarily the most optimized approach, in_array is a fairly performance-expensive function):
global $user;
if (in_array('authenticated user', $user->roles)) {
//do stuff here
}
Note that in_array can also accept an array as the "needle" (argument #1) so you could check against multiple role options:
in_array(array('authenticated user', 'anonymous user'), $user->roles);