You can use imfilter, conv2, or graycomatrix. Maybe something like
kernel = [-1 -1 -1; -1 8 -1; -1 -1 -1];
differenceImage = conv2(inputImage, kernel);
Look them up, then refine your vague question and come back if you still can't figure out what to do.