@isTest annotation is used to define the test classes which contains code to test your application and these classes does not count against your over all code coverage.
Syntax Example:
@isTest
private class MyTest {
// Methods for testing
}
testmethod keyword is used to define apex test methods. Also test methods can be defined in any apex class. But we ideally use apex test methods in test classes with @isTest annotation.
We can also use @isTest to define apex test methods which is equivalent to the testMethod keyword.
Syntax Example:
@isTest
public class myClass {
static testMethod void myTest() {
// Add test method logic here
}
}